	<layout name="layout_login" />
	
	<layout name="layout_login" />
    
	<div class="loginbox">
    	<div class="loginboxinner">
        	
            <div class="logo">
            	<div class="logo_left">
            		<img src='/Img/logo.png' width="48"/>
            	</div>
            	<div class="logo_right">	
            		<h1>{$nick}</h1>
            		<p>选择一个授权的账号登录进入</p>
            	</div>	
                
            </div><!--logo-->
            
            <div class="search_agent">
                <input type="text" id="agent_user" class="agent_keyword" value="" placeholder="账户名称">
                <!-- <button class="btn btn_metro btn_agent">检索</button> -->
            </div>
            
            
            <form id="login" action="/user/authusers" method="get">
            	<input type="hidden" name="forcefresh" value="true" />
				<div class="loginf">
		           <ul>
		           <foreach name="authorized_users" item="auth_user">
		                <li><a href="/?auth_user={$auth_user}">{$key}</a></li>
		            </foreach>
		           </ul> 
                </div>
                
				<br clear="all" /><br />

                <input type="submit" class="btn" id='sub_btn' value="刷新代理列表"/>
                            
                 <notempty name="err_msg"><div class="notifyError">{$err_msg}</div></notempty>
                 
            </form>
            
        </div><!--loginboxinner-->
    </div><!--loginbox-->
    <script type="text/javascript">
    	$("#login ul li").hover( function(){
    		$(this).addClass('hover')
    	} , function(){
    		$(this).removeClass('hover')
    	});
        
        $(".search_agent").on("input", ".agent_keyword", function() {
            var agent_keyword = $(this).val();
            var html_agent_list = '';
            // if(agent_keyword) {
                $.post('/user/search',{agent_keyword:agent_keyword},function(res) {
                    if(res['data']['total_items'] > 0) {
                        for (var i = 0; i < res['data']['total_items']; i++) {
                            html_agent_list += '<li><a href="/?auth_user='+res['data']['items'][i]['user_id']+'">'+res['data']['items'][i]['nick']+'</a></li>'
                        };
                    } else {
                        html_agent_list = '无代理用户';
                    }
                    $(".loginf ul").html(html_agent_list);
                },'json');
            // }
        })
    </script>
    <style>
        /*.search_agent {

        }*/
        .agent_keyword {
            height: 20px;
        }
        .btn_agent {
            border-color: #59008C;
            width: 40px !important;
            height: 20px;
            line-height: 20px;
            padding:1px 0 !important;
        }
    </style>
	